home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: MakeCatalog.ged 0.002 (6.10.96)
- **
- ** © 1996 Simone Tellini
- **
- ** PROGRAMNAME: MakeCatalog.ged
- **
- ** FUNCTION: Fills a blank ct file using a model one.
- **
- ** $HISTORY:
- **
- ** 11 Feb 1996 : 000.001 : initial release
- ** 6 Oct 1996 : 000.002 : 'QUIET' switch in 'WINDOW USE'
- */
-
- OPTIONS RESULTS /* enable return codes */
-
- ARG From To /* accept two arguments */
-
- if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
- address 'GOLDED.1'
-
- 'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
- if (RC ~= 0) then
- exit
-
- OPTIONS FAILAT 6 /* ignore warnings */
- SIGNAL ON SYNTAX /* ensure clean exit */
-
-
- /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
-
- 'OPEN NAME' from to 'FAST NEW'
- 'WINDOW ARRANGE 0'
-
- 'WINDOW USE' from 'QUIET'
-
- 'GOTO LINE 1 COLUMN 1' /* Copy the first 3 lines to the destination */
- 'MARK SET' /* file */
- 'GOTO LINE 3 EOL'
- 'MARK END SET'
- 'CLIP COPY'
- 'MARK HIDE'
-
- 'WINDOW USE' to 'QUIET'
-
- 'GOTO LINE 1 COLUMN 1'
- 'DELETE LINE'
- 'DELETE LINE'
- 'DELETE LINE'
- 'CLIP PASTE'
-
- 'GOTO LINE 5'
-
- 'WINDOW USE' from 'QUIET'
- 'QUERY LINES VAR LINES' /* get number of lines */
-
- line = 4
-
- 'GOTO LINE 4 COLUMN 1'
-
- DO WHILE line < lines /* ok, let's examine all the lines */
-
- 'WINDOW USE' from 'QUIET'
-
- 'DOWN'
- line = line + 1
-
- 'FIRST'
-
- 'QUERY BUFFER VAR LINEFROM'
-
- IF LEFT( linefrom, 1 ) ~== ';' THEN DO /* skip comments */
-
- 'DOWN'
- 'MARK SET'
- 'DOWN'
- 'QUERY BUFFER VAR WORD'
-
- line = line + 2;
-
- DO WHILE LEFT( word, 1 ) ~== ';' /* search for the end of */
- 'DOWN' /* the string */
- 'QUERY BUFFER VAR WORD'
- line = line + 1
- END
-
- 'QUERY BUFFER VAR LINEFROM'
-
- 'UP' /* back to last line */
- 'GOTO EOL'
- 'MARK END SET'
- 'CLIP COPY'
- 'MARK HIDE'
- 'DOWN'
-
- 'WINDOW USE' to 'QUIET'
-
- IF LENGTH( linefrom ) > 30 THEN
- search = LEFT( linefrom, 30 )
- ELSE
- search = linefrom
- /* GoldEd caused a Guru with a string of 192 chars... :( */
- /* Anyway, if the first 30 chars are equal, well, we've */
- /* got 99.9% of chances to have found the right string ;) */
-
- 'FIND STRING "'search'" FIRST WILD=FALSE CASE=TRUE QUIET'
- 'QUERY BUFFER VAR LINETO'
-
- DO WHILE lineto ~== linefrom
- 'FIND STRING "'search'" NEXT WILD=FALSE CASE=TRUE QUIET'
- ret = RC
- IF ret = 5 THEN LEAVE
- 'QUERY BUFFER VAR LINETO'
- END
-
- IF linefrom == LEFT( lineto, LENGTH( linefrom )) THEN DO
- /* IF ret = 0 THEN DO */
- /* the search was successful */
- 'UP'
- 'FIRST'
- 'DELETE LINE' /* remove the blank line */
- 'CLIP PASTE'
- END
-
- END
- END
-
- 'WINDOW USE' from 'QUIET'
- 'QUIT'
-
- 'WINDOW USE' to
-
- /* ---------------------------- END OF YOUR CODE --------------------- */
-
- 'UNLOCK' /* VERY important: unlock GUI */
- EXIT
-
- SYNTAX:
-
- SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
- 'UNLOCK'
- EXIT
-
-